package com.duan.laugh.common.security.util;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 用户
 *
 * @author duanjw
 * <p>
 * 扩展默认的security用户
 */
public class LaughUser extends User {
    /**
     * 用户ID
     */
    @Getter
    private Long id;

    /**
     * 创建的租户ID
     */
    @Getter
    private Long createTenantId;
    /**
     * 租户ID
     */
    @Getter
    private Long tenantId;

    public LaughUser(Long id, Long createTenantId, Long tenantId, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.id = id;
        this.createTenantId = createTenantId;
        this.tenantId = tenantId;
    }
}
